package com.cyzy.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.cyzy.domain.TChatmessage;
import com.cyzy.dto.ResponseData;
import com.cyzy.service.TChatmessageService;
import com.cyzy.mapper.TChatmessageMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author 10204
* @description 针对表【t_chatmessage】的数据库操作Service实现
* @createDate 2024-11-21 16:00:13
*/
@Service
public class TChatmessageServiceImpl extends ServiceImpl<TChatmessageMapper, TChatmessage> implements TChatmessageService{
   @Autowired
    private TChatmessageMapper chatmessageMapper;


    @Override
    public ResponseData getRecord(String userId) {
        QueryWrapper<TChatmessage> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("user_id", userId);
        List<TChatmessage> list = chatmessageMapper.selectList(queryWrapper);
        if(list.size()>0){
            return  new ResponseData(0,"success",list,list.size());
        }else {
            return  new ResponseData(0,"false",null,0);
        }
    }
}




